package com.lifeng.finance.demo.service;

import com.lifeng.finance.demo.entity.Customer;
import com.lifeng.finance.demo.mapper.CustomerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class CustomerService implements CustomerMapper {

    @Autowired
    private CustomerMapper customerMapper;

    public List<Customer> findAll() {
        return customerMapper.findAll();
    }

//    @Autowired
    public Customer findOneById(int id) {
        return customerMapper.findOneById(id);
    }

    public List<Customer> findSomeByName(String name) {
        name = "%" + name + "%";
        return customerMapper.findSomeByName(name);
    }

    public void add(Customer customer) {

        customerMapper.add(customer);

    }

    @Override
    public void update(Customer customer) {
        customerMapper.update(customer);
    }

}
